package cz.semjob.common.attribute.value;

import cz.semjob.common.attribute.IDistributionAttribute;

public class TextDistributionAttributeValue extends AttributeValue {

	private String value;

	private IDistributionAttribute distributionAttribute;

	public TextDistributionAttributeValue(String attrName, String value, IDistributionAttribute distributionAttribute) {
		super(attrName);
		this.distributionAttribute = distributionAttribute;
		this.value = value;
	}

	@Override
	public Object getAttrValue() {
		double distribution = distributionAttribute.getDistributionForText(value);
		if (distribution>0.05) {
			return 1d;
		} 
		return 0d; 
	}
	
	@Override
	public String toString() {
		return getAttrValue().toString();
	}

}
